#include <stdio.h>

int main()
{
    FILE * pf = fopen("a.txt","w+");
    if(NULL == pf)
        exit(-1);
    char ch;
    for(ch = 'a'; ch <= 'z'; ch++)
    {
        putchar(fputc(ch,pf));
    }

    rewind(pf);

//    while ((ch = fgetc(pf)) != EOF)
    while ((ch = fgetc(pf)) && !feof(pf)){
        putchar(ch);
    }
//    while(!feof(pf))
//    {
//        ch = fgetc(pf);
//        putchar(ch);
//    }
    fclose(pf);
    return 0;
}
